<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>手机快速登录或注册</title>
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="__STATIC__/css/base.css">
	<link rel="stylesheet" href="__STATIC__/icon/icon.css">
	<script type="text/javascript" src="__STATIC__/js/core/jquery.min.js"></script>
	<script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
</head>
<body>
<style>
header{
	background:#E94726;
	color:#FFF;
	margin-bottom:50px;
}
header ul{
	display:table;
	width:100%;
	height:50px;	
}
header ul ol,header ul li{
	display:table-cell;
	vertical-align:middle;
	text-align:center;
}
header ul ol{
	width:40px;
}
.LogoContainer{
	max-width:640px;
	margin:auto;
	position:relative;
}
.LogoContainer:before{
	content:'';
	display:block;
	padding-top:60%;
}
.LogoContainer ul{
	width:30%;
	position:absolute;
	left:50%;
	top: 50%;
  -webkit-transform: translate3D(-50%, -50%, 0);
      -ms-transform: translate3D(-50%, -50%, 0);
          transform: translate3D(-50%, -50%, 0);
}
.LogoContainer ul ol img{
	width:100%;
}
.LogoContainer ul li{
	text-align:center;
	padding-top:5%;
	color:#D43B1B;
}
.FormContainer{
	padding:0 20px;
}
.FormContainer ul{
	display:table;
	width:100%;
	border-bottom:#DDD solid 1px;
}
.FormContainer ul ol,.FormContainer ul li{
	display:table-cell;
	vertical-align:middle;
	height:40px;	
}
.FormContainer ul ol{
	width:30px;
	font-size:20px;
}
.FormContainer ul li input{
	width:99%;
	border:0;
	text-indent:5px;
	outline:none;
	background:none;
}
.FormContainer ul li input.error{
	border:#F30 solid 1px;
	border-radius:5px;
}
.FormContainer dl{
	display:table;
	width:100%;
	margin-top:20px;
}
.FormContainer dl dt,.FormContainer dl dd{
	display:table-cell;
	vertical-align:middle;
	height:30px;
	width:50%;
}
.FormContainer dl dd{
	text-align:right;
}
.OtherLogin .h{
	line-height:30px;
	margin-top:30px;
	position:relative;
	color:#888;
	text-align:center;
}
.OtherLogin .h:before{
	content:'';
	display:block;
	position:absolute;
	width:100%;
	height:1px;
	background:#DDD;
	left:0;
	top:14px;
}
.OtherLogin .h span{
	display:inline-block;
	position:relative;
	background:#FFF;
	padding:0 20px;
}
.OtherLogin .c{
	text-align:center;
	padding:15px 0;
}
.OtherLogin .c a{
	display:inline-block;
	background:#333BDD;
	padding:8px;
	margin:0 20px;
	color:#FFF;
	font-size:20px;
	border-radius:5px;
}
.OtherLogin .c a.wx{
	background:#41BD16;
}	
@media (max-width: 2000px) and (min-width:601px) {
	header ul{
		height:70px;
		font-size:24px;	
	}	
}
@media (max-width: 600px) and (min-width:501px) { 
	header ul{
		height:60px;
		font-size:20px;	
	}	
}
@media (max-width: 500px) and (min-width:401px) { 
	header ul{
		height:55px;
		font-size:18px;	
	}
}
@media (max-width: 400px) {
	header ul{
		height:50px;
		font-size:16px;	
	}
}
.butterBox{
	text-align:center;
	padding:20px 0;
	word-spacing:20px;
}
.mui-btn{
	font-size: 14px;
	font-weight: 400;
	line-height: 1.42;
	position: relative;
	display: inline-block;
	margin-bottom: 0;
	padding: 6px 12px;
	cursor: pointer;
	-webkit-transition: all;
	transition: all;
	-webkit-transition-timing-function: linear;
	transition-timing-function: linear;
	-webkit-transition-duration: .2s;
	transition-duration: .2s;
	text-align: center;
	vertical-align: top;
	white-space: nowrap;
	color: #333;
	border: 1px solid #ccc;
	border-radius: 3px;
	border-top-left-radius: 3px;
	border-top-right-radius: 3px;
	border-bottom-right-radius: 3px;
	border-bottom-left-radius: 3px;
	background-color: #fff;
	background-clip: padding-box
}
.mui-btn-danger{
	color: #fff;
	border: 1px solid #dd524d;
	background-color: #dd524d
}
.mui-btn-back{
	color: #fff;
	border: 1px solid #999;
	background-color: #AAA
}
</style>
<header>
	<ul>
		<ol><i class="fa fa-angle-left" onclick="window.history.back()"></i></ol>
		<li>手机快速登录或注册</li>
		<ol><br/></ol>
	</ul>
</header>
<div class="FormContainer">
<form class="mui-input-group" action="{:urls('login/phone_reg')}" method="post">
	
 

 
					<ul>
						<ol><i class="fa fa-fw fa-mobile-phone"></i></ol>
						<li><input type="text" name="mobphone" placeholder="请输入手机号" required/></li>
						<li>&nbsp;</li>
					</ul>
					<ul>
						<ol><i class="glyphicon glyphicon-question-sign"></i></ol>
						<li><input type="text" name="phone_code" placeholder="请点击右边文字获取验证码" onBlur="check_num($(this),'mobphone')" required/></li>
						<li><a href="#" onclick="get_code_num('mobphone')">获取验证码</a></li>
					</ul>

					<ul class="atc_username" style="display:none;">
						<ol><i class="fa fa-fw fa-user-o"></i></ol>
						<li><input type="text" name="username" minlength="3" maxlength="20" placeholder="请输入新帐号名" onBlur="checkinput($(this),'username')" required/></li>
					</ul>


				<div class="butterBox reg_btn" style="display:none;">
					<button type="submit" class="mui-btn mui-btn-danger">立即注册</button>
				</div>

	<div class="OtherLogin">
		<div class="h"><span>使用第三方一键注册登录</span></div>
		<div class="c">
			{if (!in_wxapp())}<a href="{:purl('login/qq/index')}"><i class="fa fa-fw fa-qq"></i></a>{/if}
			{if (in_weixin()||in_wxapp())}<a href="{:purl('weixin/login/index')}" class="wx"><i class="fa fa-fw fa-weixin"></i></a>{/if}
		</div>
	</div>
</form>
<script type="text/javascript">
function get_code_num(type){
	var to='';
	var obj = $(".mui-input-group input[name='"+type+"']");

	to = obj.val();
	if(to==''){
		obj.focus();
		layer.msg('请先输入手机号码');
		return false;
	}

	layer.msg('请稍候,系统正在发送手机验证码!',{time:3000});
	$.get("{:urls('login/get_phone_num')}?phone=" + to + '&'+Math.random(),function(res){
		layer.close();
		if(res.code==0){
			layer.alert('验证码已成功发出,请耐心等候,注意查收!');
			//objs.removeClass('error');
		}else{
			layer.alert(res.msg);
			//objs.addClass('error');
		}			
	});
}

function check_num(objs){
	var vals = objs.val();
	var index = layer.load(1,{shade: [0.7, '#393D49']}, {shadeClose: true}); //0代表加载的风格，支持0-2
	$.get("{:urls('login/check_phone_num')}?num=" + vals + '&'+Math.random(),function(res){
		layer.closeAll();
		if(res.code==0){
			objs.removeClass('error');
			if(res.data.type=='login'){
				layer.msg('登录成功,欢迎' + res.data.username + '您回来');
				window.location.href = "{$fromurl}";
			}else if(res.data.type=='reg'){
				layer.alert('验证成功,请为新帐号设置一个登录名');
				$(".atc_username").show();				
				//$(".atc_username input").val(res.data.username);
				$(".reg_btn").show();	
			}else{
				layer.alert(res.msg);
			}
		}else{
			layer.msg(res.msg);
			objs.addClass('error');
		}			
	});
}

function checkinput(objs,type){
	var vals=objs.val();
	$.get("{:urls('reg/check')}?"+type+"="+vals+'&'+Math.random(),function(d){
		if(d=='ok'){
			objs.removeClass('error');
		}else{
			layer.msg(d);
			//objs.focus();
			objs.addClass('error');
		}			
	});
}

</script>
</div>
</body>
</html>